import {
  LEAVE_LIST,
  LEAVE_UPDATE
} from '../reducersTypes'
const initState = {
  list: [],
  count: 0
}

export default (state=initState, actions) => {
  const newState = JSON.parse(JSON.stringify(state))

  switch (actions.type) {
    case LEAVE_LIST:
      newState.list = actions.payload
      break;
    case LEAVE_UPDATE:
      newState.count++
      break;
  
    default:
      break;
  }
  return newState
}